package com.knight.spring.framework.aop.adapter;

import com.knight.spring.framework.aop.intercept.KnightMethodInterceptor;
import com.knight.spring.framework.aop.intercept.KnightMethodInvocation;

import java.lang.reflect.Method;

public class KnightMethodBeforeAdviceInterceptor extends KnightAbstractAspectAdvice {


    public KnightMethodBeforeAdviceInterceptor(Method aspectMethod, Object aspectTarget) {
        super(aspectMethod, aspectTarget);
    }


    private void before(KnightJoinPoint joinPoint){
        try {
            super.invokeAdviceMethod(joinPoint,null,null);
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }


    @Override
    public Object invoke(KnightMethodInvocation invocation) throws Throwable {
        before(invocation);
        return invocation.proceed();
    }
}
